package cn.tinlan.shopcoin;

import android.app.Application;
import android.content.Context;
import android.util.Log;

import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import com.zhouyou.http.EasyHttp;

import cn.tinlan.shopcoin.Utils.RudenessScreenHelper;
import cn.tinlan.shopcoin.widget.category.Constants;

/**
 * Created by Mortimer on 2018/11/20. 16:35
 * 佛祖🙏，永无bug。
 */
public class ShopCoinApplication extends Application {

    private static Context mContext;

    @Override
    public void onCreate() {
        super.onCreate();

        new RudenessScreenHelper(this,750).activate();

        mContext = getApplicationContext();

        EasyHttp.init(this);

        EasyHttp.getInstance().setBaseUrl(Constants.BathURL)
                .debug("EasyHttp",true);

    }


    /**
     * 注册到微信
     */
    private void regToWx() {
        wxapi = WXAPIFactory.createWXAPI(this.getApplicationContext(), Constants.WXAPP_ID, true);
        wxapi.registerApp(Constants.WXAPP_ID);
    }

    private static IWXAPI wxapi;

    public static IWXAPI getWxapi() {
        return wxapi;
    }

    public static void setWxapi(IWXAPI wxapi) {
        ShopCoinApplication.wxapi = wxapi;
    }
    /**
     * 获取ApplicationContext
     *
     * @return
     */
    public static Context getAppContext() {
        return mContext;
    }
}
